#include <stdio.h>

#define Max(a,b) ((a)>(b)?(a):(b))
#define Abs(a,b) ((a)>(b)?((a)-(b)):((b)-(a)))

int equalSubstring(char* s, char* t, int maxCost) {
    int maxLen=0,curCost=0,left=0,right=0;
    while( *(s+right) ){
        curCost+=Abs( *(s+right),*(t+right) );
        while( curCost > maxCost ){
            curCost-=Abs( *(s+left),*(t+left) );
            left++;
        }
        maxLen=Max(maxLen,right-left+1);
        right++;
    }
    return maxLen;
}

int main(){
    char s[]="abcd",t[]="acde";
    int maxCost=0;
    printf("%d\n",equalSubstring(s,t,maxCost));
    return 0;
}
